/**
 * @created by wy on 2019-7-9 10:13:24
 * @updated by
 * @description dashboard
 */
define([
	'libs/echarts/echarts-3.8.5.min.js'
], function(require, exports) {
	/**
	 * 页面加载完成时触发
	 * @param hashCode 路由ID
	 * @param data 传递数据对象
	 * @param cite 页面站点信息
	 */
	exports.ready = function(hashCode, data, cite) {
		var vm = yufp.custom.vue({
				el: cite.el,
				data: function() {
					return {
						addCust: 'first',
						importIndex: 'importIndex1',
						rankType: 'rankType1',
						themeColor: yufp.frame.baseFrame.themes.color,
						userId: yufp.session.userId,
						isSelected: true,
						isSelected1: false,
						addCustRankByOrgData:[],
						addCustRankByUserData:[],
						importIndexRank1Data:[],
						importIndexRank2Data:[],
						importIndexRank3Data:[],
						importIndexRank4Data:[],
						simuProfitData:[],
						gridOverviewInfoData:[],
						gridViscosityRank1Data:[],
						gridViscosityRank2Data:[],
						gridViscosityRank3Data:[],
						gridViscosityRank4Data:[],
						gridVisitRankData:[]
					};
				},
				created: function () {
					this.queryAddCustRankByOrg();
					this.queryAddCustRankByUser();
					this.queryImportIndexRank1();
					this.queryImportIndexRank2();
					this.queryImportIndexRank3();
					this.queryImportIndexRank4();
					this.querySimuProfit();
					this.queryGridOverviewInfo();
					this.queryGridViscosityRank1();
					this.queryGridViscosityRank2();
					this.queryGridViscosityRank3();
					this.queryGridViscosityRank4();
					this.queryGridVisitRank();
				},
				methods: {
					handleClick: function (tab, event) {
						yufp.logger.info(tab, event);
					},
					queryAddCustRankByOrg:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryAddCustRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									statisType:'01'
								})
							},callback: function(code, message, response) {
								me.addCustRankByOrgData =response.data;

							}
						});
					},
					queryAddCustRankByUser:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryAddCustRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									statisType:'02'
								})
							},callback: function(code, message, response) {
								me.addCustRankByUserData =response.data;
					
							}
						});
					},
					//指标类型：01存款02经营贷03苏农贷04社保卡激活
					queryImportIndexRank1:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryImportIndexRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									indexType:'01'
								})
							},callback: function(code, message, response) {
								me.importIndexRank1Data =response.data;
					
							}
						});
					},
					queryImportIndexRank2:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryImportIndexRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									indexType:'02'
								})
							},callback: function(code, message, response) {
								me.importIndexRank2Data =response.data;
					
							}
						});
					},
					queryImportIndexRank3:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryImportIndexRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									indexType:'03'
								})
							},callback: function(code, message, response) {
								me.importIndexRank3Data =response.data;
					
							}
						});
					},
					queryImportIndexRank4:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryImportIndexRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									indexType:'04'
								})
							},callback: function(code, message, response) {
								me.importIndexRank4Data =response.data;
					
							}
						});
					},
					querySimuProfit:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/querySimuProfitRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
								})
							},callback: function(code, message, response) {
								me.simuProfitData =response.data;
					
							}
						});
					},
					queryGridOverviewInfo:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryGridOverviewInfo',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
								})
							},callback: function(code, message, response) {
								me.gridOverviewInfoData =response.data;
					
							}
						});
					},
					//排名类型01产品数02产品提升数03人均产品数04人均产品提升数
					queryGridViscosityRank1:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryGridViscosityRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									rankType:'01'
								})
							},callback: function(code, message, response) {
								me.gridViscosityRank1Data =response.data;
					
							}
						});
					},
					queryGridViscosityRank2:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryGridViscosityRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									rankType:'02'
								})
							},callback: function(code, message, response) {
								me.gridViscosityRank2Data =response.data;
					
							}
						});
					},
					queryGridViscosityRank3:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryGridViscosityRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									rankType:'03'
								})
							},callback: function(code, message, response) {
								me.gridViscosityRank3Data =response.data;
					
							}
						});
					},
					queryGridViscosityRank4:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryGridViscosityRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
									rankType:'04'
								})
							},callback: function(code, message, response) {
								me.gridViscosityRank4Data =response.data;
					
							}
						});
					},
					queryGridVisitRank:function (){
						var me= this;
						yufp.service.request({
							url: '/api/leaderShipCockpit/queryGridVisitRank',
							method: 'GET',
							data: {
								condition: JSON.stringify({
									userId: yufp.session.userId,
									orgId: yufp.session.user.org.code,
								})
							},callback: function(code, message, response) {
								me.gridVisitRankData =response.data;
					
							}
						});
					},
			},}
			);
}; exports.onmessage = function(type, message, cite, vm) {
	// type 01
	if (type == 'themes') {
		vm.themeColor = message.color;
	}
};
});
